package com.igeek.d0618.test8;

import com.igeek.d0607.Test4;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

/**
 * @Author: zhiyu
 * @Date:19:25
 * @DESC:
 */
public class Test {
    public static void main(String[] args) {
        try (
                InputStream inputStream = Test.class.getResourceAsStream("test.properties");
        ){
            Properties properties = new Properties();
            properties.load(inputStream);
            String className = properties.getProperty("className");
            Class<?> aClass = Class.forName(className);
            Object o = aClass.newInstance();
            Method run = aClass.getMethod("run");
            run.invoke(o);
        } catch (IOException | NoSuchMethodException | IllegalAccessException | InstantiationException |
                 InvocationTargetException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
